
#include <pic18.h>
#include "hardware.h"
#include "sys_clock.h"
#include "uart.h"
#include "app.h"

//#define   SYSTIME_PERIOD 	(-1250) //(0xFFFF - 1250) //100  for 10mSec
//#define   SYSTIME_PERIOD 	(-125) // 1 ms

//extern volatile near bit TimeI_10ms;
#define   SYS_CLOCK_MAX			0x7FFF
extern volatile near unsigned int sys_clock_cnt;


void interrupt ISR ( void )
{
	if ( TMR0IF )
	{
	  	TMR0 = -SYS_CLOCK_PERIOD;	 
		sys_clock_cnt++;
		TMR0IF = 0;		
	}

	if ( RCIF )
	{		
		uart_receiver();
		
/* 		while(!TXIF)	/\* set when register is empty *\/ */
/* 			continue; */
/* 		TXREG = RCREG;  */

		RCIF = 0;
	}
	
	
/* 	if ( RBIF ) */
/* 	{ */
/* 		PORTB = PORTB; */
/* 		RBIF = 0; */
/* 		RBIE = 0; */
/* 	} */
}
